﻿using System.Collections.Generic;
using SG.Lang.Dry.Base;
using SG.Lang.Dry.Controlling;
using SG.Lang.Dry.Mirrors;

namespace SG.Lang.Dry.Code
{
    public class VirtualAssembly : Element
    {
        private readonly IEnumerable<TypeRef> _typeRefs; 

        private VirtualAssembly(ref ElementRecord elementRecord, ref VirtualAssemblyRecord virtualAssemblyRecord)
            : base(ref elementRecord)
        {
            _typeRefs = virtualAssemblyRecord.TypeList.ResolveTypes();
        }

        public VirtualAssembly(ref ElementRecord elementRecord, IEnumerable<TypeRef> typeRefs)
            : base(ref elementRecord)
        {
            _typeRefs = typeRefs;
        }

        public IEnumerable<TypeRef> TypeRefs { get { return _typeRefs; } }

        public static VirtualAssembly Create(ref ElementRecord elementRecord, ref VirtualAssemblyRecord virtualAssemblyRecord)
        {
            return new VirtualAssembly(ref elementRecord, ref virtualAssemblyRecord);
        }
    }
}
